Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mobile): new sync #16556

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

feat(mobile): new sync #16556

wants to merge 3 commits into from

Conversation

alextran1502
Copy link
Contributor

No description provided.

Copy link
Contributor

github-actions bot commented Mar 3, 2025

Label error. Requires exactly 1 of: changelog:.*. Found: 📱mobile. A maintainer will add the required label.

}

Request? _getRequest(List<SyncRequestType> types) {
final serverUrl = Store.tryGet(StoreKey.serverUrl);
Copy link
Contributor Author

@alextran1502 alextran1502 Mar 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shenlong-tanwen I saw your note on not accessing the Store directly in the repo. How do you propose to access these values here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we can extend the ApiClient from the generated open-api code and add a new method to return the response directly as a stream rather than a future. Then create a new class such as SyncMobileApi and add it to the ApiService, which will pass our custom client to the api class.

Or to simplify it,
Api Service -> Custom Sync API (Custom API Client injected)
Sync Repo -> Depends on the Custom Sync API Class -> Api Service

import 'package:immich_mobile/infrastructure/repositories/sync_api.repository.dart';
import 'package:immich_mobile/repositories/user.repository.dart';

final syncStreamServiceProvider = Provider(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the provider to providers/infrastructure/

),
);

class SyncApiRepository extends DatabaseRepository
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extend IsarDatabaseRepository and make the class const

);
break;
default:
debugPrint("[_parseSyncReponse] Unknown type $type");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer logs instead. We implicitly call debugPrint on log calls during debug builds anyways. We can use finer or finest for logs like these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants